home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / tspa3160.zip / TSUNTG.INT < prev    next >
Text File  |  1992-11-08  |  8KB  |  222 lines

  1. {$B-,D-,F-,I+,N-,R-,S+,V+}
  2.  
  3. (*
  4. Timo Salmi UNiT G
  5. A Turbo Pascal unit of informative routines, Crt replacements,
  6. keyboad routines, redirection, and reboot.
  7. All rights reserved 26-Nov-89
  8. Updated 6-Dec-89, 20-Mar-90, 22-Jul-90, 1-Aug-90, 8-Aug-90, 27-Oct-91,
  9.         13-Jun-92, 19-Oct-92, 8-Nov-92
  10.  
  11. This unit may be used and distributed freely for PRIVATE, NON-COMMERCIAL,
  12. NON-INSTITUTIONAL purposes, provided it is not changed in any way. For
  13. ANY other usage, such as use in a business enterprise or a university,
  14. contact the author for the terms of registration.
  15.  
  16. The units are under development. Comments and contacts are solicited. If
  17. you have any questions, please do not hesitate to use electronic mail for
  18. communication.
  19. InterNet address: ts@uwasa.fi         (preferred)
  20. Bitnet address:   SALMI@FINFUN
  21.  
  22. The author shall not be liable to the user for any direct, indirect or
  23. consequential loss arising from the use of, or inability to use, any unit,
  24. program or file howsoever caused. No warranty is given that the units and
  25. programs will work under all circumstances.
  26.  
  27. Timo Salmi
  28. Professor of Accounting and Business Finance
  29. Faculty of Accounting & Industrial Management; University of Vaasa
  30. P.O. BOX 297, SF-65101 Vaasa, Finland
  31.  
  32. Added 27-Oct-91:
  33.  ISANSIFN
  34.  
  35. Added 13-Jun-92
  36.  GETSCAN
  37.  GETESCAN
  38.  
  39. Added 19-Oct-92:
  40.  FLOPSTFN
  41.  ISUBSTFN
  42.  
  43. Added 8-Nov-92:
  44.  ACTDRVFN
  45.  MEDIAFN
  46.  
  47. *)
  48.  
  49. unit TSUNTG;
  50.  
  51. (* ======================================================================= *)
  52.                           interface
  53. (* ======================================================================= *)
  54.  
  55. uses Dos
  56.      {$IFDEF VER40}
  57.      ,TSUNT45
  58.      {$ENDIF}
  59.      ;
  60.  
  61. (* =======================================================================
  62.                      Informative routines
  63.    ======================================================================= *)
  64.  
  65. (* Number of diskette drives on the system *)
  66. function DRIVESFN : byte;
  67.  
  68. (* The name of the first diskette drive on the system *)
  69. function FDRIVEFN : char;
  70.  
  71. (* Number of disk devices. Only for MsDos 3.+, else returns 0, harcoded *)
  72. function DSKCNTFN : byte;
  73.  
  74. (* Is a media present in the given drive. Argument '0' can be used to
  75.    denote the default drive *)
  76. function INDRIVFN (drive : char) : boolean;
  77.  
  78. (* Is a media a fixed disk. Takes the drive letter (case independent) as
  79.    the argument. Argument '0' can be used for the default drive *)
  80. function FIXEDFN (drive : char) : boolean;
  81.  
  82. (* Get the floppy disk status. Is the floppy present and formatted.
  83.    For the status values see TSUNTG.TST procedure TEST16, or
  84.    interrupt $13 function $01 in Ralf Brown's inter32a.zip *)
  85. function FLOPSTFN (drive : char) : integer;
  86.  
  87. (* Test whether a drive is a substituted drive, that is has been subjected
  88.    to the MsDos subst command.  Requires a minumum of MsDos 3.1 *)
  89. function ISUBSTFN (drive : char) : boolean;
  90.  
  91. (* What kind of a disk media is in a disk drive.
  92.    Takes the drive letter (case independent) as the argument.
  93.    Argument '0' can be used for the default drive.
  94.    For the returned values see TEST18 in TSUNTG.TST
  95. *)
  96. function MEDIAFN (drive : char) : byte;
  97.  
  98. (* Get the currently active floppy drive on one drive systems.
  99.    Returns the drive letter 'A' or 'B'.
  100.    For an error returns '0', for two drive systems returns '2'. *)
  101. function ACTDRVFN : char;
  102.  
  103. (* =======================================================================
  104.                Crt replacements and their derivates
  105.    ======================================================================= *)
  106.  
  107. (* Set a 25*80 text mode and clear screen, no Crt unit required *)
  108. procedure CLS;
  109.  
  110. (* Set a 25*40 text mode and clear screen, no Crt unit required *)
  111. procedure CLS40;
  112.  
  113. (* As Turbo Pascal GoToYX but does not require the Crt unit *)
  114. procedure GOATXY (x, y : integer);
  115.  
  116. (* As Turbo Pascal WhereX but does not require the Crt unit *)
  117. function WHEREXFN : byte;
  118.  
  119. (* As Turbo Pascal WhereY but does not require the Crt unit *)
  120. function WHEREYFN : byte;
  121.  
  122. (* Reverse the colors of an area.
  123.    This is slow. For fast screen routines see TSUNTA. *)
  124. procedure REVAREA (x1, y1, x2, y2 : integer);
  125.  
  126. (* Returns whether ANSI.SYS or a similar screen driver has been loaded or not.
  127.    Use while in the text mode. Do not call not in the graphics modes.
  128.    Don't use the TP Crt unit in your program if you want ISANSIFN to work. *)
  129. function ISANSIFN : boolean;
  130.  
  131. (* =======================================================================
  132.                 Key routines with no Ctr needed
  133.    ======================================================================= *)
  134.  
  135. (* As Turbo Pascal KeyPressed but does not require the Crt unit *)
  136. function KEYPREFN : boolean;
  137.  
  138. (* As Turbo Pascal ReadKey but does not require the Crt unit *)
  139. function READKEFN : char;
  140.  
  141. (* Enhanced keyboard ReadKey, no Ctr unit needed. Detects also F11 and F12,
  142.    and distinguishes between the numeric keypad and the gray keys.
  143.    Lower part of the word returns the first scan code, the higher part
  144.    the second, if applicable. *)
  145. function RDENKEFN : word;
  146.  
  147. (* This function resembles the traditional Basic inkey function.
  148.    It returns the pressed character with no echo. Special chacarters
  149.    are returned in the usual paired manner (chr(0) + code).
  150.    If timelimit seconds is exceeded timeout becomes true (and a
  151.    chr(0) is returned by inkeyfn). *)
  152. function INKEYFN (timelimit : real; var timeout : boolean) : char;
  153.  
  154. (* =======================================================================
  155.         More key routines with no Ctr needed, no key repeat
  156.    ======================================================================= *)
  157.  
  158. (* Is the left shift key depressed *)
  159. function LFSHFTFN : boolean;
  160.  
  161. (* Is the right shift key depressed *)
  162. function RTSHFTFN : boolean;
  163.  
  164. (* Is the ctrl key depressed *)
  165. function CTRLFN : boolean;
  166.  
  167. (* Is the left ctrl key depressed *)
  168. function LFCTRLFN : boolean;
  169.  
  170. (* Is the right ctrl key depressed *)
  171. function RTCTRLFN : boolean;
  172.  
  173. (* Is the alt key depressed *)
  174. function ALTFN : boolean;
  175.  
  176. (* Is the left alt key depressed *)
  177. function LFALTFN : boolean;
  178.  
  179. (* Is the right alt key depressed *)
  180. function RTALTFN : boolean;
  181.  
  182. (* Is the SysRq key depressed *)
  183. function SYSRQFN : boolean;
  184.  
  185.  
  186. (* =======================================================================
  187.                   Getting keyscan codes
  188.    ======================================================================= *)
  189.  
  190. (* Every now and then a programmer need to find out the scan codes
  191.    of the keyboard keys. GETSCAN returns the scancode (and the ascii
  192.    value) of the key pressed. For an enhanced AT keyboard use
  193.    GETESCAN. Goes to TSUNTG *)
  194. procedure GETSCAN (var scancode, character : byte);
  195.  
  196. (* Get scancode and ascii value of a key pressed for an enhanced
  197.    keyboard. To test the presence of an enhanced keyboard use
  198.    ISENHAFN from the TSUNTH unit *)
  199. procedure GETESCAN (var scancode, character : byte);
  200.  
  201. (* =======================================================================
  202.                       Redirection
  203.    ======================================================================= *)
  204.  
  205. (* Direct write and writeln to printer *)
  206. procedure USEPRN;
  207.  
  208. (* Direct write and writeln to the screen *)
  209. procedure USECON;
  210.  
  211. (* =======================================================================
  212.                            Reboot
  213.    ======================================================================= *)
  214.  
  215. (* Reboot the computer without memory tests. Resembles alt-ctrl-del.
  216.    Inline coded. Use judiciously *)
  217. procedure WARMBOOT;
  218.  
  219. (* Reboot the computer with memory tests. Inline coded. Use judiciously *)
  220. procedure COLDBOOT;
  221.  
  222.